export default function usePagination(callback, options = {}) {
  const pagination = reactive({
    currentPage: 1,
    pageSize: 10,
    total: 0,
    size: "default",
    background: true,
    layout: "total, prev, pager, next, sizes, jumper",
    pageSizes: [10, 20, 50],
    hideOnSinglePage: false,
  });
  Object.assign(pagination, options);
  const currentChange = (val) => {
    pagination.currentPage = val;
    callback && callback();
  };
  const sizeChange = (val) => {
    pagination.currentPage = 1;
    pagination.pageSize = val;
    callback && callback();
  };
  return {
    pagination,
    currentChange,
    sizeChange,
  };
}
